// +build js

package jsgo

import "syscall/js"

type JsWindow struct {
	JsObject
	Document *JsDocument
	Location *JsLocation
	Console  *JsConsole
}

func (win *JsWindow) Alert(msg interface{}) {
	win.value.Call("alert", msg)
}

var Window *JsWindow
var Console *JsConsole
var Document *JsDocument
var Location *JsLocation

func init() {
	Window = &JsWindow{JsObject: JsObject{
		value: js.Global(),
	}}
	Console = &JsConsole{JsObject{
		value: js.Global().Get("console"),
	}}
	Document = &JsDocument{JsObject{
		value: js.Global().Get("document"),
	}}
	Location = &JsLocation{JsObject{
		value: js.Global().Get("location"),
	}}
	Window.Document = Document
	Window.Location = Location
	Window.Console = Console
}
